package com.yixun.qfbao.hander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.PremisesApiService;
import com.yixun.qfbao.apidto.GetPremisesListReqDto;
import com.yixun.qfbao.apidto.GetPremisesListResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetPremisesListReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * （3）获取项目
 * 
 * @author jzliu
 *		
 */
@Service("getPremisesListHander")
public class GetPremisesListHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(GetPremisesListHander.class);
	
	@Autowired
	private PremisesApiService premisesService;
	
	@SuppressWarnings("rawtypes")
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		GetPremisesListReqVo req = (GetPremisesListReqVo)reqDto;
		GetPremisesListReqDto reqDto1 = req.getParams();
		BaseResponseDTO<GetPremisesListResDto> res = new BaseResponseDTO<GetPremisesListResDto>();
		GetPremisesListResDto resDto = new GetPremisesListResDto();
		try {
			resDto = premisesService.getPremisesList(reqDto1);
		} catch (Exception e) {
			logger.error("GetPremisesListHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("获取项目失败!");
		}
		res.setResData(resDto);
		res.setResult(resDto.getResult());
		return res;
	}
	
}
